<?php
if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

class plugin_hux_toweixin {

	function hux_toweixin() {
		global $_G;
		$wxsetting = $_G['cache']['plugin']['hux_toweixin'];
		$weixintishi = explode('|',$wxsetting['tishi']);
		$urlToEncode = str_replace('&','%26','http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
		if ($wxsetting['show'] == 1) {
			$r = '<a class="followp" href="javascript:;" onclick="showWindow(\'hux_toweixin\', \'plugin.php?id=hux_toweixin:hux_toweixin&chl='.$urlToEncode.'\', \'get\', 0);" title="'.$weixintishi[1].'"><i><img src="source/plugin/hux_toweixin/images/weixin.png" alt="'.$weixintishi[0].'" />'.$weixintishi[0].'</i></a>';
		} else {
			$r = '<a style="background:white url(source/plugin/hux_toweixin/images/weixin.png) no-repeat 5px 50%;" href="javascript:;" onclick="showWindow(\'hux_toweixin\', \'plugin.php?id=hux_toweixin:hux_toweixin&chl='.$urlToEncode.'\', \'get\', 0);" title="'.$weixintishi[1].'">'.$weixintishi[0].'</a>';
		}
		return $r;
	}

}

class plugin_hux_toweixin_forum extends plugin_hux_toweixin {
	
	function viewthread_useraction_output() {
		global $_G;
		$wxsetting = $_G['cache']['plugin']['hux_toweixin'];
		if ($wxsetting['show'] == 1) {
			return $this->hux_toweixin();
		} else {
			return '';
		}
	}
	
	function viewthread_postfooter_output() {
		global $_G;
		$wxsetting = $_G['cache']['plugin']['hux_toweixin'];
		if ($wxsetting['show'] == 2) {
			return array($this->hux_toweixin());
		}
		return array();
	}
}

class plugin_hux_toweixin_group extends plugin_hux_toweixin {
	
	function viewthread_useraction_output() {
		global $_G;
		$wxsetting = $_G['cache']['plugin']['hux_toweixin'];
		if ($wxsetting['show'] == 1) {
			return $this->hux_toweixin();
		} else {
			return '';
		}
	}
	
	function viewthread_postfooter_output() {
		global $_G;
		$wxsetting = $_G['cache']['plugin']['hux_toweixin'];
		if ($wxsetting['show'] == 2) {
			return array($this->hux_toweixin());
		}
		return array();
	}
}

class plugin_hux_toweixin_portal extends plugin_hux_toweixin {
	
	function view_article_op_extra_output() {
		global $_G;
		$wxsetting = $_G['cache']['plugin']['hux_toweixin'];
		$weixintishi = explode('|',$wxsetting['tishi']);
		$urlToEncode = str_replace('&','%26','http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
		$r = '<a class="oshr" style="background:white url(source/plugin/hux_toweixin/images/weixin.png) no-repeat 5px 50%;" href="javascript:;" onclick="showWindow(\'hux_toweixin\', \'plugin.php?id=hux_toweixin:hux_toweixin&chl='.$urlToEncode.'\', \'get\', 0);" title="'.$weixintishi[1].'">'.$weixintishi[0].'</a>';
		return $r;
	}
}
?>